package com.snailhd.websocket;

import com.snailhd.common.entity.ResultVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author hd
 * @description
 * @date 2019-12-02 12:18
 */

@Controller
@RequestMapping("websocket/info")
public class WebSocketController {


    @RequestMapping("connectCnt")
    @ResponseBody
    public ResultVO<Integer> connectCount(){
        Integer count =  WebSocketHandler.SESSIONS.size();
        return new ResultVO<Integer>().generateSuccess(count);
    }
}
